using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
public partial class Admin_DiaDiemEdit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            load_data();
        }
    }
    private void load_data()
    {
        try
        {
            int iD = int.Parse(Request.QueryString["id"].ToString());
            tbDiaDiem diadiem = tbDiaDiemBUS.GetById(iD);
            if (diadiem != null)
            {
                txt_MaDD.Text = diadiem.IdDiaDiem.ToString();
                txt_TenDD.Text = diadiem.TenDiaDiem.ToString();
            }
        }
        catch
        {
            Response.Redirect("~/Admin/DiaDiemList.aspx");
        }
    }
    protected void btn_Update_Click(object sender, EventArgs e)
    {
        try
        {
            tbDiaDiem diadiem = tbDiaDiemBUS.GetById(int.Parse(txt_MaDD.Text));
            diadiem.TenDiaDiem = txt_TenDD.Text;
            tbDiaDiemBUS.Update(diadiem);
            Response.Redirect("~/Admin/DiaDiemList.aspx");
        }
        catch 
        {
            Response.Redirect("~/Admin/DiaDiemList.aspx");
           
        }
    }
}
